package myTest

import java.io.{BufferedInputStream, File, FileInputStream, FileOutputStream, PrintWriter}
import java.util.zip.GZIPInputStream

import play.api.libs.json._
import tool.{FormTool, Tool}
import implicits.Implicits._
import org.apache.commons.io.FileUtils
import org.joda.time.DateTime
import shapeless.PolyDefns.~>
import shapeless._
import utils.Utils
import shapeless.record._
import shapeless.ops.record._
import tool.Pojo.MyData

import scala.io.Source

/**
 * Created by yz on 3/3/2020
 */
object Test {

  def main(args: Array[String]): Unit = {
    val startTime = System.currentTimeMillis()
    val parent = new File("C:\\p3_database\\test")
    val outParent = new File("C:\\p3_database\\test\\assemble")

    //不更改 / 更改

    val orignalFqFiles = List(new File(parent, "QF4_R1.fq.gz"), new File(parent, "QF4_R2.fq.gz"))
    orignalFqFiles.foreach { file =>
      Utils.unGzip2Iter(file) { lines =>
        val outFile = new File(outParent, s"${file.getName.replaceAll(".gz$", "")}")
        lines.take(50000).toList.toFile(outFile)
        Utils.gZip(outFile, new File(outParent, file.getName))
      }
    }

    //    val json=Json.obj("test"->true)
    //    println(json.toString())


    println(Utils.getTime(startTime))

    object choose extends (Set ~> Option) {
      def apply[T](s: Set[T]) = s.headOption
    }

    def pairApply(f: Set ~> Option) = (f(Set(1, 2, 3)), f(Set('a', 'b', 'c')))

    val sets = Set(1) :: Set("foo") :: HNil
    val rs = sets map choose
    println(rs)


  }

}


